Skip to content

feat(cli): galaxy visualizer — self-contained interactive HTML graph explorer (6F.8)#49

Merged
officialCodeWork merged 1 commit into
developmentfrom
build/phase-6f/step-6f.8-visualizer
Jul 15, 2026
Merged

feat(cli): galaxy visualizer — self-contained interactive HTML graph explorer (6F.8)#49
officialCodeWork merged 1 commit into
developmentfrom
build/phase-6f/step-6f.8-visualizer

Conversation

@officialCodeWork

Copy link
Copy Markdown
Owner

Summary

Implements the feature you requested: once scan emits the graph JSON, ui-lineage visualize turns it into an interactive HTML page you can open in a browser and explore — all nodes and their interconnections laid out like a galaxy, with options to inspect your own repo.

ui-lineage scan ./src -o app.graph.json
ui-lineage visualize -g app.graph.json -o app.galaxy.html
open app.galaxy.html   # no server, no network

What it produces

A single self-contained HTML file — graph JSON plus all CSS/JS inlined, zero network requests — safe to double-click or share. The client is a canvas force-directed "galaxy": components are the stars, their instances/hooks/state/data-sources cluster around them, routes act as gravitational centers. All 9 node kinds are color-coded with a legend.

Exploration options:

  • Toggle any node kind or edge kind on/off (with all/none)
  • Search a node and fly the camera to it
  • Click a node → detail panel (name, kind, file:line, connection count, flags) with its neighborhood highlighted and everything else dimmed — a visual blast radius
  • Drag to pin a node, scroll to zoom, pause the physics, always-on labels

Built with grid-approximated repulsion (neighbor cells only) so it stays responsive at real-codebase scale (thousands of nodes) where SVG would choke.

Design & safety

  • renderVisualization(graph) is a pure function (graph in, HTML string out) — trivially testable; toViewModel trims nodes to what the client needs and drops dangling edges
  • Embedded JSON escapes <, so rendered text containing </script> can't break out of the data script (tested)

Verification

  • Driven live in the in-app browser against the demo-app graph: renders, filters, physics toggle, and search→select all work with zero console errors; loads over file:// and http:// with no external requests
  • CLI package gained a test script + vitest; 5 new tests (embed round-trip, dangling-edge drop, </script> breakout guard, self-contained assertions)
  • pnpm eval unaffected (290/0/0/0); typecheck clean; README documents the command

Note

This is 6F.8. The only remaining Phase 6F step is 6F.6 (test-coverage hardening), which is blocked on a real failing sample — our fixture's custom-wrapper test shape already produces covered-by edges, so the field's "1 edge app-wide" failure comes from a variant we haven't seen yet.

🤖 Generated with Claude Code

…explorer (6F.8)

New `ui-lineage visualize -g <graph> -o <html>` renders the whole lineage
graph as a single self-contained HTML file (graph JSON + all CSS/JS inlined,
zero network requests) that opens in any browser with no server.

- visualize.ts: pure renderVisualization(graph) → HTML string (trivially
  testable) + toViewModel trimming nodes and dropping dangling edges. The
  embedded JSON escapes "<" so rendered text containing "</script>" can't
  break out of the data script.
- Client: canvas force-directed "galaxy" with grid-approximated repulsion
  (neighbor-cell only) that scales to thousands of nodes; node radius by
  degree; 9 node kinds color-coded with a legend.
- Interactions: per-kind node + edge filter toggles, search-and-fly, click →
  detail panel (name, kind, file:line, connection count, flags) with neighbor
  highlight + dim-others (visual blast radius), drag-to-pin, scroll-zoom,
  physics pause, always-labels.

Verified live in-browser on the demo-app graph: renders, filters, physics
toggle, and search→select all work with zero console errors.

CLI package gains a test script + vitest; 5 new tests (embed round-trip,
dangling-edge drop, </script> breakout guard, self-contained output). README
documents the command. Eval unaffected (290/0/0/0); typecheck clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@officialCodeWork
officialCodeWork merged commit 359317e into development Jul 15, 2026
1 check passed
This was referenced Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants